package demo519;


import demo519.Emp;

import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class TestMap {

    //1
    public void addEmp(Map<String, Emp> map, Emp emp) {

        map.put(emp.getNumber(), emp);
    }

    //2
    public void findAllEmp(Map<String, Emp> map) {
        for (Emp emp : map.values()) {
            System.out.println(emp);
        }
    }

    //3
    public Emp findEmpName(Map<String, Emp> map, String empName) {
        for (Emp emp : map.values()) {
            if (empName.equals(emp.getName())) {
                return emp;
            }
        }
        return null;
    }

    //4
    public void deleteEmp(Map<String, Emp> map, String empNumber) {

        Emp emp = map.remove(empNumber);
    }

    //5
    public Emp findEmpNumber(Map<String, Emp> map, String empNumber) {
        return map.get(empNumber);
    }

    //6
    public void updateEmp(Map<String, Emp> map, Emp emp) {

        map.put(emp.getNumber(), emp);
    }


}
